package script.mainpage
{
	import laya.components.Script;
	import laya.events.Event;
	import laya.utils.Browser;
	
	import script.ViewManager;
	
	import ui.common.PayOrderPaelUI;
	
	public class ConfirmPayController extends Script
	{
		private var uiSkin:PayOrderPaelUI;
		
		public var param:Object;
		
		public function ConfirmPayController()
		{
			super();
		}
		
		
		override public function onStart():void
		{
			uiSkin = this.owner as PayOrderPaelUI;
			
			uiSkin.totalMoney.text = "¥" + param.money;
			
			uiSkin.orderId.text = param.orderId;
			

			uiSkin.okBtn.on(Event.CLICK,this,function(){
				
				ViewManager.instance.closeView(ViewManager.VIEW_CONFIRM_PAY_PANEL);
				
			});
			
			uiSkin.copytBtn.on(Event.CLICK,this,copyOrderId);
			
		}

		private function copyOrderId():void
		{
			var dateInput = Browser.document.createElement("input");				
			
			dateInput.type ="text";
			dateInput.value = uiSkin.orderId.text;
			Browser.document.body.appendChild(dateInput);//添加到舞台
			dateInput.select();
			
			window.document.execCommand('copy');
			Browser.document.body.removeChild(dateInput);//添加到舞台		
		}
		
		
	}
}